<?php
namespace Home\Model;
use Think\Model;
class PurchaseModel extends Model{
	
	public function root_type($name){
		$where['username'] = $name;
		$account = M("account");
		$res = $account->field("purchase")->where($where)->find();
		return $res;
	}
	
	
	public function product_list($name,$status){
		$where['buyer'] = $name;
		$where['status'] = $status;
		$product = M("product");
		$res = $product->field("buyer,supplier,sku,main_pic,cost_price")->where($where)->select();
		return $res;
	}
	
	public function sku_list($sku,$status){
		$where['sku'] = array("like","%$sku%");
		$where['status'] = $status;
		$order = M("order");
		$res = $order->field("salesman,order_number,quantity,discount_rate")->where($where)->group("order_number")->select();
		
		return $res;
	}
	
	
	
}


?>